<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta
      name="viewport"
      content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"
    />
    <meta name="theme-color" content="#000000" />
    <!--
      manifest.json provides metadata used when your web app is added to the
      homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
    -->
    <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
    <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
    <!--
      Notice the use of %PUBLIC_URL% in the tags above.
      It will be replaced with the URL of the `public` folder during the build.
      Only files inside the `public` folder can be referenced from the HTML.

      Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
      work correctly both with client-side routing and a non-root public URL.
      Learn how to configure a non-root public URL by running `npm run build`.
    -->
    <title>财务放行</title>
  </head>
  <body>
    <noscript> You need to enable JavaScript to run this app. </noscript>
    <div id="root"></div>
    <script>
      // 动态设置视口缩放为1/dpr
      (function(doc, win) {
        var docEl = win.document.documentElement;
        var resizeEvt =
          "orientationchange" in window ? "orientationchange" : "resize";
        var metaEl = doc.querySelector('meta[name="viewport"]');
        var dpr = 0;
        var scale = 0;

        // 对iOS设备进行dpr的判断，对于Android系列，始终认为其dpr为1
        if (!dpr && !scale) {
          var isAndroid = win.navigator.appVersion.match(/android/gi);
          var isIPhone = win.navigator.appVersion.match(/[iphone|ipad]/gi);
          var devicePixelRatio = win.devicePixelRatio;

          if (isIPhone) {
            dpr = devicePixelRatio;
          } else {
            drp = 1;
          }

          scale = 1 / dpr;
        }

        /**
    * ================================================
    *   设置data-dpr和viewport
    × ================================================
    */

        docEl.setAttribute("data-dpr", dpr);
        // 动态改写meta:viewport标签
        if (!metaEl) {
          metaEl = doc.createElement("meta");
          metaEl.setAttribute("name", "viewport");
          metaEl.setAttribute(
            "content",
            "width=device-width, initial-scale=" +
              scale +
              ", maximum-scale=" +
              scale +
              ", minimum-scale=" +
              scale +
              ", user-scalable=no"
          );
          document.documentElement.firstElementChild.appendChild(metaEl);
        } else {
          metaEl.setAttribute(
            "content",
            "width=device-width, initial-scale=" +
              scale +
              ", maximum-scale=" +
              scale +
              ", minimum-scale=" +
              scale +
              ", user-scalable=no"
          );
        }
      })(document, window);
      // 动态设置根元素fontsize
      /**
       * 以下这段代码是用于根据移动端设备的屏幕分辨率计算出合适的根元素的大小
       * 当设备宽度为375(iPhone6)时，根元素font-size=16px; 依次增大；
       * 限制当为设备宽度大于768(iPad)之后，font-size不再继续增大
       * scale 为meta viewport中的缩放大小
       */
      (function(doc, win) {
        var docEl = win.document.documentElement;
        var resizeEvt =
          "orientationchange" in window ? "orientationchange" : "resize";
        /**
    * ================================================
    *   设置根元素font-size
    * 当设备宽度为375(iPhone6)时，根元素font-size=16px; 
    × ================================================
    */
        var refreshRem = function() {
          var clientWidth =
            win.innerWidth ||
            doc.documentElement.clientWidth ||
            doc.body.clientWidth;

          // console.log(clientWidth);
          if (!clientWidth) return;
          var fz;
          var width = clientWidth;
          fz = (16 * width) / 375;
          docEl.style.fontSize = fz + "px";
        };

        if (!doc.addEventListener) return;
        win.addEventListener(resizeEvt, refreshRem, false);
        doc.addEventListener("DOMContentLoaded", refreshRem, false);
        refreshRem();
      })(document, window);
    </script>
    <!--
      This HTML file is a template.
      If you open it directly in the browser, you will see an empty page.

      You can add webfonts, meta tags, or analytics to this file.
      The build step will place the bundled scripts into the <body> tag.

      To begin the development, run `npm start` or `yarn start`.
      To create a production bundle, use `npm run build` or `yarn build`.
    -->
  </body>
</html>
